#region head comment
/*
Code generate by YhdSdkTool.
email:starpeng@vip.qq.com
2013-01-21 23:00:56:915 +08:00
*/
#endregion

using System;
using System.Xml.Serialization;
using System.Collections.Generic;
using YhdSdk.Domain;
using YhdSdk.Domain.Product;
using YhdSdk.Response.Product;

namespace YhdSdk.Request.Product
{
    /// <summary>
    /// 新增一个系列产品
    ///<para></para>
    ///<para>增加一个系列产品(虚品+系列子品)，成功则返回成功记录数，失败则返回失败记录数和相应错误描述信息。</para>
    ///<para>注意：产品名称前的品牌名称必须与选择的品牌id对应的品牌名称一致才可以通过审核</para>
    /// </summary>
    public class YhdSerialProductAddRequest : IYhdRequest<YhdSerialProductAddResponse>
    {
        /// <summary>
        /// 产品类别ID(从获取授权产品类别yhd.category.products.get接口中获取叶子ID,需要支持系列产品)
        /// </summary>
        /// <example>957436</example>
        [XmlElement("categoryId")]
        public Int64 CategoryId
        {
            get;
            set;
        }

        /// <summary>
        /// 商家产品类别ID列表(逗号分隔,从yhd.category.merchant.products.get接口中获取叶子ID)
        /// </summary>
        /// <example>12931</example>
        [XmlArray("merchantCategoryIdList")]
        [XmlArrayItem("string")]
        public List<String> MerchantCategoryIdList
        {
            get;
            set;
        }

        /// <summary>
        /// 产品名称(产品名称开头必须以品牌名或品牌名加英文空格开头,不超过100个字符)
        /// </summary>
        /// <example>品牌名 产品名</example>
        [XmlElement("productCname")]
        public String ProductCname
        {
            get;
            set;
        }

        /// <summary>
        /// 产品名称副标题(不超过100个字符)
        /// </summary>
        [XmlElement("productSubTitle")]
        public String ProductSubTitle
        {
            get;
            set;
        }

        /// <summary>
        /// 产品名称前缀(不超过10个字符)
        /// </summary>
        [XmlElement("productNamePrefix")]
        public String ProductNamePrefix
        {
            get;
            set;
        }

        /// <summary>
        /// 品牌ID(从获取授权品牌yhd.category.brands.get接口中获取)
        /// </summary>
        /// <example>909986</example>
        [XmlElement("brandId")]
        public Int64 BrandId
        {
            get;
            set;
        }

        /// <summary>
        /// 外部产品编码(不超过30个字符)
        /// </summary>
        /// <example>out048</example>
        [XmlElement("outerId")]
        public String OuterId
        {
            get;
            set;
        }

        /// <summary>
        /// 市场价(最多两位小数)
        /// </summary>
        [XmlElement("productMarketPrice")]
        public Double ProductMarketPrice
        {
            get;
            set;
        }

        /// <summary>
        /// 销售价(不能大于市场价,最多两位小数)
        /// </summary>
        [XmlElement("productSalePrice")]
        public Double ProductSalePrice
        {
            get;
            set;
        }

        /// <summary>
        /// 重量(毛重KG,最多两位小数)
        /// </summary>
        [XmlElement("weight")]
        public Double Weight
        {
            get;
            set;
        }

        /// <summary>
        /// 库存(大于或等于0)
        /// </summary>
        [XmlElement("virtualStockNum")]
        public Int64 VirtualStockNum
        {
            get;
            set;
        }

        /// <summary>
        /// 是否可销(0否;1是)
        /// </summary>
        /// <example>0</example>
        [XmlElement("canSale")]
        public Nullable<Int32> CanSale
        {
            get;
            set;
        }

        /// <summary>
        /// 产品描述(不超过300kb)
        /// </summary>
        /// <example>&lt;a href=&quot;#&quot;&gt;y&lt;/a&gt;</example>
        [XmlElement("productDescription")]
        public String ProductDescription
        {
            get;
            set;
        }

        /// <summary>
        /// 电子凭证(是或否)
        /// </summary>
        [XmlElement("electronicCerticate")]
        public String ElectronicCerticate
        {
            get;
            set;
        }

        /// <summary>
        /// 产品属性列表(每个属性之间用逗号分隔,属性ID和属性值之间用冒号分隔。如属性ID:属性值),属性id不能重复
        /// </summary>
        /// <example>3281:电费1,3282:电费2</example>
        [XmlArray("prodAttributeInfoList")]
        [XmlArrayItem("prodAttributeInfo")]
        public List<ProdAttributeInfo> ProdAttributeInfoList
        {
            get;
            set;
        }

        /// <summary>
        /// 属性项列表(每个属性之间用逗号分隔,属性ID和选项ID之间用冒号分隔,选项ID之间用竖线分隔。如属性ID:选项ID1|选项ID2),属性id不能重复,也不能同上面的属性ID相同,同一个属性ID不能有相同的选项ID
        /// </summary>
        /// <example>2882:10708,3280:11497|11499</example>
        [XmlArray("prodAttributeItemInfoList")]
        [XmlArrayItem("prodAttributeItemInfo")]
        public List<ProdAttributeItemInfo> ProdAttributeItemInfoList
        {
            get;
            set;
        }

        /// <summary>
        /// 系列子品信息列表(逗号分隔)
        /// </summary>
        [XmlArray("serialAttributesInfoList")]
        [XmlArrayItem("serialAttributesInfo")]
        public List<SerialAttributesInfo> SerialAttributesInfoList
        {
            get;
            set;
        }

        /// <summary>
        /// Api接口名称
        /// </summary>
        public String ApiName
        {
            get{ return "yhd.serial.product.add"; }
        }

        /// <summary>
        /// 获取参数列表
        /// </summary>
        public IDictionary<string, string> GetParameters()
        {
            YhdDictionary parameters = new YhdDictionary();
            parameters.Add("categoryId" ,this.CategoryId);
            parameters.Add("merchantCategoryIdList" ,this.MerchantCategoryIdList);
            parameters.Add("productCname" ,this.ProductCname);
            parameters.Add("productSubTitle" ,this.ProductSubTitle);
            parameters.Add("productNamePrefix" ,this.ProductNamePrefix);
            parameters.Add("brandId" ,this.BrandId);
            parameters.Add("outerId" ,this.OuterId);
            parameters.Add("productMarketPrice" ,this.ProductMarketPrice);
            parameters.Add("productSalePrice" ,this.ProductSalePrice);
            parameters.Add("weight" ,this.Weight);
            parameters.Add("virtualStockNum" ,this.VirtualStockNum);
            parameters.Add("canSale" ,this.CanSale);
            parameters.Add("productDescription" ,this.ProductDescription);
            parameters.Add("electronicCerticate" ,this.ElectronicCerticate);
            parameters.Add("prodAttributeInfoList" ,this.ProdAttributeInfoList);
            parameters.Add("prodAttributeItemInfoList" ,this.ProdAttributeItemInfoList);
            parameters.Add("serialAttributesInfoList" ,this.SerialAttributesInfoList);
            return parameters;
        }

        /// <summary>
        /// 验证参数
        /// </summary>
        public void Validate()
        {
            RequestValidator.ValidateRequired("categoryId", this.CategoryId);
            RequestValidator.ValidateRequired("merchantCategoryIdList", this.MerchantCategoryIdList);
            RequestValidator.ValidateRequired("productCname", this.ProductCname);
            RequestValidator.ValidateRequired("brandId", this.BrandId);
            RequestValidator.ValidateRequired("outerId", this.OuterId);
            RequestValidator.ValidateRequired("productMarketPrice", this.ProductMarketPrice);
            RequestValidator.ValidateRequired("productSalePrice", this.ProductSalePrice);
            RequestValidator.ValidateRequired("weight", this.Weight);
            RequestValidator.ValidateRequired("virtualStockNum", this.VirtualStockNum);
            RequestValidator.ValidateRequired("electronicCerticate", this.ElectronicCerticate);
            RequestValidator.ValidateRequired("serialAttributesInfoList", this.SerialAttributesInfoList);
        }

    }
}
